package com.hongxin.nw.netty.model.analysis.info;

import io.netty.buffer.ByteBuf;
import lombok.extern.slf4j.Slf4j;

/**
 * @remark 表A.1.1 交流充电桩充电过程实时监测数据
 * @author: GuoXiaolin
 * @date 2019/6/11 15:51
 * @Version 1.0
 * @Descibe
 */
@Slf4j
public class Mjcna1_1{
    private String a1;//1	充电设备编号	132：M_MD_NA_1	压缩BCD码	8Byte	充电设备编号
    private String a2;//2	充电接口标识	1：M_SP_NA_1	BIN码	1Byte	充电设备为一桩多充时用来标记接口号，一桩一充时此项为0。多个接口时顺序对每个接口进行编号
    private String a3;//3	连接确认开关状态	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传;0关，1开
    private String a4;//4	工作状态	11：M_ME_NB_1	压缩BCD码	2Byte	0001-告警0002-待机0003-工作 0004-离线 0005-完成
    private String a5;//5	交流输入过压告警	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传；0不过压，1过压
    private String a6;//6	交流输入欠压告警	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传；0不欠压，1欠压
    private String a7;//7	充电电流过负荷告警	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传；0不过负荷，1过负荷
    private String a8;//8	充电输出电压	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后一位
    private String a9;//9	充电输出电流	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后二位
    private String a10;//10	输出继电器状态	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传;0关，1开
    private String a11;//11	有功总电度	132：M_MD_NA_1	BIN码	4Byte	精确到小数点后一位
    private String a12;//12	（当前）A相电压	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后一位
    private String a13;//13	（当前）B相电压	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后一位
    private String a14;//14	（当前）C相电压	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后一位
    private String a15;//15	（当前）A相电流	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后二位
    private String a16;//16	（当前）B相电流	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后二位
    private String a17;//17	（当前）C相电流	11：M_ME_NB_1	BIN码	2Byte	精确到小数点后二位
    private String a18;//18	温度过高保护	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传，1过高
    private String a19;//19	短路保护	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传，1发生
    private String a20;//20	漏电保护	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传，1发生
    private String a21;//21	急停开关触发	1：M_SP_NA_1	BIN码	1Byte	布尔型, 变化上传，1触发

    private int idx = 0;
    private ByteBuf byteBuf;

    private void subA1() {
//        this.a1 = substring(TypeIdentif.BYTE_JC_A1.getByteLength());
//        this.a1 = FieldAnalysis.analysisBCD(this.a1);
    }

    private void subA2() {
//        this.a2 = substring(TypeIdentif.BYTE_JC_A2.getByteLength());
//        this.a2 = FieldAnalysis.analysisBin(this.a2);
    }

    private void subA3() {
//        this.a3 = substring(TypeIdentif.BYTE_JC_A3.getByteLength());
//        this.a3 = FieldAnalysis.analysisBin(this.a3);
    }

    private void subA4() {
//        this.a4 = substring(TypeIdentif.BYTE_JC_A4.getByteLength());
//        this.a4 = FieldAnalysis.analysisBCD(this.a4);
    }

    private void subA5() {
//        this.a5 = substring(TypeIdentif.BYTE_JC_A5.getByteLength());
//        this.a5 = FieldAnalysis.analysisBin(this.a5);
    }

    private void subA6() {
//        this.a6 = substring(TypeIdentif.BYTE_JC_A6.getByteLength());
//        this.a6 = FieldAnalysis.analysisBin(this.a6);
    }

    private void subA7() {
//        this.a7 = substring(TypeIdentif.BYTE_JC_A7.getByteLength());
//        this.a7 = FieldAnalysis.analysisBin(this.a7);
    }

    private void subA8() {
//        this.a8 = substring(TypeIdentif.BYTE_JC_A8.getByteLength());
//        this.a8 = FieldAnalysis.hexToDecimal(this.a8, 1);
    }

    private void subA9() {
//        this.a9 = substring(TypeIdentif.BYTE_JC_A9.getByteLength());
//        this.a9 = FieldAnalysis.hexToDecimal(this.a9,2);
    }

    private void subA10() {
//        this.a10 = substring(TypeIdentif.BYTE_JC_A10.getByteLength());
//        this.a10 = FieldAnalysis.analysisBin(this.a10);
    }

    private void subA11() {
//        this.a11 = substring(TypeIdentif.BYTE_JC_A11.getByteLength());
//        this.a11 = FieldAnalysis.hexToDecimal(this.a11, 1);
    }

    private void subA12() {
//        this.a12 = substring(TypeIdentif.BYTE_JC_A12.getByteLength());
//        this.a12 = FieldAnalysis.hexToDecimal(this.a12, 1);
    }

    private void subA13() {
//        this.a13 = substring(TypeIdentif.BYTE_JC_A13.getByteLength());
//        this.a13 = FieldAnalysis.hexToDecimal(this.a13, 1);
    }

    private void subA14() {
//        this.a14 = substring(TypeIdentif.BYTE_JC_A14.getByteLength());
//        this.a14 = FieldAnalysis.hexToDecimal(this.a14, 1);
    }

    private void subA15() {
//        this.a15 = substring(TypeIdentif.BYTE_JC_A15.getByteLength());
//        this.a15 = FieldAnalysis.hexToDecimal(this.a15,2);
    }

    private void subA16() {
//        this.a16 = substring(TypeIdentif.BYTE_JC_A16.getByteLength());
//        this.a16 = FieldAnalysis.hexToDecimal(this.a16,2);
    }

    private void subA17() {
//        this.a17 = substring(TypeIdentif.BYTE_JC_A17.getByteLength());
//        this.a17 = FieldAnalysis.hexToDecimal(this.a17,2);
    }

    private void subA18() {
//        this.a18 = substring(TypeIdentif.BYTE_JC_A18.getByteLength());
//        this.a18 = FieldAnalysis.analysisBin(this.a18);
    }

    private void subA19() {
//        this.a19 = substring(TypeIdentif.BYTE_JC_A19.getByteLength());
//        this.a19 = FieldAnalysis.analysisBin(this.a19);
    }

    private void subA20() {
//        this.a20 = substring(TypeIdentif.BYTE_JC_A20.getByteLength());
//        this.a20 = FieldAnalysis.analysisBin(this.a20);
    }

    private void subA21() {
//        this.a21 = substring(TypeIdentif.BYTE_JC_A21.getByteLength());
//        this.a21 = FieldAnalysis.analysisBin(this.a21);
    }

    public Mjcna1_1 analysisStr(int idx, ByteBuf byteBuf) {
        this.idx = idx;
        this.byteBuf = byteBuf;
        subA1();
        subA2();
        subA3();
        subA4();
        subA5();
        subA6();
        subA7();
        subA8();
        subA9();
        subA10();
        subA11();
        subA12();
        subA13();
        subA14();
        subA15();
        subA16();
        subA17();
        subA18();
        subA19();
        subA20();
        subA21();
        log.info(toString());
        return this;
    }

    @Override
    public String toString() {
        return "Mjcna1_1{" +
                "a1='" + a1 + '\'' +
                ", a2='" + a2 + '\'' +
                ", a3='" + a3 + '\'' +
                ", a4='" + a4 + '\'' +
                ", a5='" + a5 + '\'' +
                ", a6='" + a6 + '\'' +
                ", a7='" + a7 + '\'' +
                ", a8='" + a8 + '\'' +
                ", a9='" + a9 + '\'' +
                ", a10='" + a10 + '\'' +
                ", a11='" + a11 + '\'' +
                ", a12='" + a12 + '\'' +
                ", a13='" + a13 + '\'' +
                ", a14='" + a14 + '\'' +
                ", a15='" + a15 + '\'' +
                ", a16='" + a16 + '\'' +
                ", a17='" + a17 + '\'' +
                ", a18='" + a18 + '\'' +
                ", a19='" + a19 + '\'' +
                ", a20='" + a20 + '\'' +
                ", a21='" + a21 + '\'' +
                '}';
    }
}
